<!DOCTYPE HTML>
<#assign ctx=request.contextPath />
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1 ,minimum-scale=1.0 ,maximum-scale=1.0" user-scalable=no>
<title>我的账户</title>
<link href="${ctx}/assets/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="${ctx}/assets/css/weixing.css" />
<link rel="stylesheet" href="${ctx}/assets/css/hook.css" />
</head>
<body>
<div class="hook" id="hook">
</div>
  	<ul id="thelist">
  
	</ul>
	<div style="text-align:center" id="loadmore">
		点击加载更多
	</div>
<script src="${ctx}/assets/js/jquery-1.11.0.min.js"></script>
<script src="${ctx}/assets/js/bootstrap.min.js"></script>
<script src="${ctx}/assets/js/mousewheel.js"></script>
<script src="${ctx}/assets/js/hook.js"></script>
<script type="text/javascript">
var myScroll,
	pullDownEl, pullDownOffset,
	pullUpEl, pullUpOffset,
	generatedCount = 0;
function load (page) {
		 	$.ajax({
             type: "GET",
             url: "${ctx}/wx/v1/account2",
             data: {
             'memberId':'${memberId}',
             'pager.offset':(page-1)*10,
             'limit':10
             },	
             dataType: "json",
             success: function(data){
             if(data.length==0 && $("li > p").val()==null){
            	 $("#loadmore").html("暂无账户记录");
             }
             if(null!=data &&data.length>0 ){
             	var content="";
             	var recordCreatedStr,recordMoney,recordPayType,recordBalance;
 				$.each(data, function (i,order) { 
 				recordCreatedStr=order.recordCreatedStr;
 				recordMoney=order.recordMoney;
 				recordPayType=order.recordPayType;
 				recordBalance=order.recordBalance;
 					content+='<li class="list-group-item">';
 					content+='<p style="text-align:left; float: left; margin-bottom: 0px;">';
 					content+=recordCreatedStr;
 					content+='</p>';
 					if(recordMoney>0){
 					content+='<p style="text-align: right; margin-bottom: 0px; color: #06b9d9;">+';
 					content+=recordMoney;
 					content+='</p>';
 					}else{
 					content+='<p style="text-align: right; margin-bottom: 0px; color: #FF0000;">';
 					content+=recordMoney;
 					content+='</p>';
 					}
 					content+='<p style="text-align:left; float: left; margin-bottom: 0px;">';
 					content+=recordPayType;
 					content+='</p>';
 					content+='<p style="text-align: right; margin-bottom: 0px;">';
 					content+=recordBalance;
 					content+='</p>';
 					content+='</li>';
 				}); 
				   if(page==1){
			       	 $("#thelist").empty();
			       }
			       $("#thelist").append(content);
			    }else if( $("li > p").val()!=null) {
			    	$("#loadmore").html("没有更多账户记录了");
			    }
              }
       		});
}
var page = 1;
$(document).ready(function(){
	load(1);
	$('#hook').hook({
		reloadPage:false,
		reloadEl:function(){
			load(1);
			page=1;
			$("#loadmore").html("点击加载更多");
		}
	});
	
	$("#loadmore").click(function(){
		page++;
		if($("#loadmore").html()=="没有更多账户记录了"||$("#loadmore").html()=="暂无账户记录"){
		}else{
			load(page);
		}
	});
});
</script>   
</body>
</html>